Make multihead-safe; use a different IM context per display.
authorAlex Larsson <alexl@redhat.com>
Tue, 30 Apr 2002 15:51:29 +0000 (15:51 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 30 Apr 2002 15:51:29 +0000 (15:51 +0000)
Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>

        * modules/input/gtkimcontextxim.c: Make multihead-safe;
        use a different IM context per display.

        * configure.in acconfig.h: Add Xinerama checks from
        multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.

        * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.

2002-04-29  Alex Larsson  <alexl@redhat.com>

        * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
        Use tmp also if foreground is set.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
modules/input/gtkimcontextxim.c
modules/input/gtkimcontextxim.h

index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index 8841599690e21c22f6c00ec8cc14e60ed89a5b1d..bed5567b588e81d213c02229c957edec80eb7516 100644 (file)
@@ -1,3 +1,18 @@
+Tue Apr 30 11:37:09 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * modules/input/gtkimcontextxim.c: Make multihead-safe;
+       use a different IM context per display.
+
+       * configure.in acconfig.h: Add Xinerama checks from
+       multihead branch, changing HAS_XINERAMA => HAVE_XINERAMA.
+
+       * gdk/x11/gdkdisplay-x11.c: HAS_XINERAMA => HAVE_XINERAMA.
+
+2002-04-29  Alex Larsson  <alexl@redhat.com>
+
+       * gdk/gdkpango.c (gdk_draw_layout_line_with_colors):
+       Use tmp also if foreground is set.
+
 Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>
 
        Integrate Erwann Chenede's multihead changes for the gtk/ directory.
index a76b667de1de86dadd52c1d9b5c49cc4f1b3c7dd..193edb57459c56d38781fbde229e922056a5a67b 100644 (file)
@@ -27,6 +27,7 @@
 
 struct _GtkXIMInfo
 {
+  GdkDisplay *display;
   XIM im;
   char *locale;
   XIMStyle style;
@@ -61,7 +62,7 @@ static GObjectClass *parent_class;
 
 GType gtk_type_im_context_xim = 0;
 
-static GSList *open_ims = NULL;
+GSList *open_ims = NULL;
 
 void
 gtk_im_context_xim_register_type (GTypeModule *type_module)
@@ -171,16 +172,19 @@ setup_im (GtkXIMInfo *info)
 }
 
 static GtkXIMInfo *
-get_im (const char *locale)
+get_im (GdkDisplay *display,
+       const char *locale)
 {
-  GSList *tmp_list = open_ims;
+  GSList *tmp_list;
   GtkXIMInfo *info;
   XIM im = NULL;
 
+  tmp_list = open_ims;
   while (tmp_list)
     {
       info = tmp_list->data;
-      if (!strcmp (info->locale, locale))
+      if (info->display == display &&
+         strcmp (info->locale, locale) == 0)
        return info;
 
       tmp_list = tmp_list->next;
@@ -193,13 +197,14 @@ get_im (const char *locale)
       if (!XSetLocaleModifiers (""))
        g_warning ("can not set locale modifiers");
       
-      im = XOpenIM (GDK_DISPLAY(), NULL, NULL, NULL);
+      im = XOpenIM (GDK_DISPLAY_XDISPLAY (display), NULL, NULL, NULL);
       
       if (im)
        {
          info = g_new (GtkXIMInfo, 1);
          open_ims = g_slist_prepend (open_ims, im);
-         
+
+         info->display = display;
          info->locale = g_strdup (locale);
          info->im = im;
 
@@ -246,6 +251,7 @@ gtk_im_context_xim_finalize (GObject *obj)
       context_xim->ic = NULL;
     }
  
+  g_free (context_xim->locale);
   g_free (context_xim->mb_charset);
 }
 
@@ -273,22 +279,22 @@ gtk_im_context_xim_set_client_window (GtkIMContext          *context,
 
   reinitialize_ic (context_xim);
   context_xim->client_window = client_window;
+
+  if (context_xim->client_window)
+    context_xim->im_info = get_im (gdk_drawable_get_display (context_xim->client_window), context_xim->locale);
+  else
+    context_xim->im_info = NULL;
 }
 
 GtkIMContext *
 gtk_im_context_xim_new (void)
 {
-  GtkXIMInfo *info;
   GtkIMContextXIM *result;
   const gchar *charset;
 
-  info = get_im (setlocale (LC_CTYPE, NULL));
-  if (!info)
-    return NULL;
-
   result = GTK_IM_CONTEXT_XIM (g_object_new (GTK_TYPE_IM_CONTEXT_XIM, NULL));
 
-  result->im_info = info;
+  result->locale = g_strdup (setlocale (LC_CTYPE, NULL));
   
   g_get_charset (&charset);
   result->mb_charset = g_strdup (charset);
@@ -333,6 +339,7 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   KeySym keysym;
   Status status;
   gboolean result = FALSE;
+  GdkWindow *root_window = gdk_screen_get_root_window (gdk_drawable_get_screen (event->window));
 
   XKeyPressedEvent xevent;
 
@@ -344,7 +351,7 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   xevent.send_event = event->send_event;
   xevent.display = GDK_DRAWABLE_XDISPLAY (event->window);
   xevent.window = GDK_DRAWABLE_XID (event->window);
-  xevent.root = GDK_ROOT_WINDOW();
+  xevent.root = GDK_DRAWABLE_XID (root_window);
   xevent.subwindow = xevent.window;
   xevent.time = event->time;
   xevent.x = xevent.x_root = 0;
@@ -957,14 +964,16 @@ status_window_configure (GtkWidget         *toplevel,
   GdkRectangle rect;
   GtkRequisition requisition;
   gint y;
+  gint height = gdk_screen_get_height (gtk_widget_get_screen (toplevel));
+  
 
   gdk_window_get_frame_extents (toplevel->window, &rect);
   gtk_widget_size_request (status_window, &requisition);
 
-  if (rect.y + rect.height + requisition.height < gdk_screen_height ())
+  if (rect.y + rect.height + requisition.height < height)
     y = rect.y + rect.height;
   else
-    y = gdk_screen_height () - requisition.height;
+    y = height - requisition.height;
   
   gtk_window_move (GTK_WINDOW (status_window), rect.x, y);
 
index ddda56826a8279764d4ca66717d86465f8644044..d8c31f75ce1177fc7f62e405c357066622c17c39 100644 (file)
@@ -48,7 +48,8 @@ struct _GtkIMContextXIM
   GtkIMContext object;
 
   GtkXIMInfo *im_info;
-  
+
+  gchar *locale;
   gchar *mb_charset;
 
   GdkWindow *client_window;